package ca.skygazer.shared.account;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Vector;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import ca.skygazer.shared.coords.LatLonCoord;

@SuppressWarnings("serial")
@PersistenceCapable(detachable="true")
public class SgUser implements Serializable {

	@SuppressWarnings("unused")
	@PrimaryKey	
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
    private String encodedKey;
    
    @Persistent
	private String email;
	
    @Persistent
	private String nickname;
    
    @Persistent
    private Date lastLogin;
    
    @Persistent(mappedBy="user", defaultFetchGroup="true")
    List<LatLonCoord> viewingLocations;
    
    public SgUser(){
    	viewingLocations = new Vector<LatLonCoord>();
    	viewingLocations.add(new LatLonCoord(0,0));
    }    
    
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getNickname() {
		return nickname;
	}
	public void setNickname(String nickname) {
		this.nickname = nickname;
	}
	public Date getLastLogin() {
		return lastLogin;
	}
	public void setLastLogin(Date lastLogin) {
		this.lastLogin = lastLogin;
	}
	public List<LatLonCoord> getViewingLocations() {
		return viewingLocations;
	}
	public void setViewingLocations(Vector<LatLonCoord> viewingLocations) {
		this.viewingLocations = viewingLocations;
	}
    
    
}
